home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF-Interest Archive / May 96 / Re Tech Q Additional Storage < prev    next >
Encoding:
Internet Message Format  |  1996-12-03  |  2.8 KB  |  [TEXT/ttxt]

  1. Subject:     Re: Tech Q: Additional Storage Units
  2. Sent:        5/29/96 9:00 AM
  3. Received:    5/29/96 9:08 AM
  4. From:        Henri Lamiraux, lamiraux@apple.com
  5. Reply-To:    ODF Interest, ODF-Interest@CILabs.ORG
  6. To:          OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
  7.  
  8. >On page 301 of the _IM:OpenDoc Programmer's Guide_, there is a recipe for
  9. >creating additional storage units.
  10. >
  11. >Here's what I'm unclear about. Should I call GetStrongStorageUnitRef every
  12. >time I externalize my part, or should I save the strong reference and write
  13. >the same thing to my main storage unit's value each time?
  14. >
  15. >Also, how/when do I dispose of the Strong Reference (i.e., if I no longer
  16. >need it).
  17. >
  18. >The question is prompted by ODF's internalization/externalization model,
  19. >which is geared toward doing it all at once, as opposed to on an as needed
  20. >basis (as I understand it). But I guess I see no reason why an ODF Content
  21. >object couldn't have access to the storage unit when needed.
  22. >
  23. >Brad
  24. >
  25. >
  26. >Richard B. "Brad" Hutchings
  27. >General Partner,
  28. >Hutchings Software Development
  29. >
  30. >hsd@earthlink.net
  31.  
  32. To use a secondary storage unit you need first to create it (for example 
  33. the first time you externalize your part or at init time). At externalize 
  34. time store the strong reference to your secondary storage unit in your 
  35. part kind value instead of writing there your data. In your secondary 
  36. storage unit create whatever property/value you need and write your data. 
  37. If you support multiple kind you need to write out the other kinds the 
  38. normal way in the part storage unit. Which raises an interesting point, 
  39. if you are using a standard kind for your part kind (like plain text) it 
  40. means that you cannot use a secondary storage. Otherwise another editor 
  41. won't be able to read it. You can only use a secondary storage for your 
  42. own private kind.
  43.  
  44. At internalize time, focus on your part kind, read the strong reference, 
  45. acquire the storage unit using the strong reference and then focus on 
  46. what ever property/value is needed in the secondary storage unit.
  47.  
  48. You don't have to read/write everything at once with ODF. You can for 
  49. example write to your storage unit anytime you want. OpenDoc will still 
  50. call Externalize went your part is saved. What you may want to do (and I 
  51. have already added that to ODF release 2) is add a fDirty flag to your 
  52. part. Set it to true when changing your data. When writting your data 
  53. outside of an externalize set this flag to false. When OpenDoc calls 
  54. Externalize test this flag and don't do anything if the flag is false.
  55.  
  56. .......................................................................
  57.  Henri Lamiraux                                      lamiraux@apple.com
  58.  Apple Computer, Inc.                 OpenDoc(tm) Development Framework
  59. .......................................................................
  60.  
  61.